package com.ruoyi.zhoubao.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zhoubao.domain.ReqZbTran23;
import com.ruoyi.zhoubao.service.IReqZbTran23Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * zhoubao23Controller
 * 
 * @author 刘佳
 * @date 2025-09-29
 */
@Controller
@RequestMapping("/zhoubao/tran23")
public class ReqZbTran23Controller extends BaseController
{
    private String prefix = "zhoubao/tran23";

    @Autowired
    private IReqZbTran23Service reqZbTran23Service;

    @RequiresPermissions("zhoubao:tran23:view")
    @GetMapping()
    public String tran23()
    {
        return prefix + "/tran23";
    }

    /**
     * 查询zhoubao23列表
     */
    @RequiresPermissions("zhoubao:tran23:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ReqZbTran23 reqZbTran23)
    {
        startPage();
        List<ReqZbTran23> list = reqZbTran23Service.selectReqZbTran23List(reqZbTran23);
        return getDataTable(list);
    }

    /**
     * 导出zhoubao23列表
     */
    @RequiresPermissions("zhoubao:tran23:export")
    @Log(title = "zhoubao23", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ReqZbTran23 reqZbTran23)
    {
        List<ReqZbTran23> list = reqZbTran23Service.selectReqZbTran23List(reqZbTran23);
        ExcelUtil<ReqZbTran23> util = new ExcelUtil<ReqZbTran23>(ReqZbTran23.class);
        return util.exportExcel(list, "zhoubao23数据");
    }

    /**
     * 新增zhoubao23
     */
    @RequiresPermissions("zhoubao:tran23:add")
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存zhoubao23
     */
    @RequiresPermissions("zhoubao:tran23:add")
    @Log(title = "zhoubao23", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ReqZbTran23 reqZbTran23)
    {
        return toAjax(reqZbTran23Service.insertReqZbTran23(reqZbTran23));
    }

    /**
     * 修改zhoubao23
     */
    @RequiresPermissions("zhoubao:tran23:edit")
    @GetMapping("/edit/{行别}")
    public String edit(@PathVariable("行别") String 行别, ModelMap mmap)
    {
        ReqZbTran23 reqZbTran23 = reqZbTran23Service.selectReqZbTran23By行别(行别);
        mmap.put("reqZbTran23", reqZbTran23);
        return prefix + "/edit";
    }

    /**
     * 修改保存zhoubao23
     */
    @RequiresPermissions("zhoubao:tran23:edit")
    @Log(title = "zhoubao23", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ReqZbTran23 reqZbTran23)
    {
        return toAjax(reqZbTran23Service.updateReqZbTran23(reqZbTran23));
    }

    /**
     * 删除zhoubao23
     */
    @RequiresPermissions("zhoubao:tran23:remove")
    @Log(title = "zhoubao23", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(reqZbTran23Service.deleteReqZbTran23By行别s(ids));
    }
}
